﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web;

namespace LPY.LeHealth.WebSite.Common
{
    public class SecurityHelper
    {
        /// <summary>
        /// 产生随机的验证码
        /// </summary>
        /// <param name="length">验证码长度</param>
        /// <returns>验证码</returns>
        public static string CreateCode(int length)
        {
            if (length <= 0)
            {
                return string.Empty;
            }

            Random random = new Random();
            StringBuilder builder = new StringBuilder();
            for (int i = 0; i < length; i++)
            {
                builder.Append(random.Next(0, 10));
            }
            return builder.ToString();
        }
    }
}